﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _05_NeighbourComparer
{
    class Program
    {
        static bool IsBiggerThenNeighbours(int[] searchedArray, int numberIndex)
        {
            if (numberIndex <= 0)
            {
                return false;
            }
            if (numberIndex >= searchedArray.Length - 1)
            {
                return false;
            }

            if (searchedArray[numberIndex] > searchedArray[numberIndex - 1] &&
                searchedArray[numberIndex] > searchedArray[numberIndex + 1])
            {
                return true;
            }

            return false;
        }

        static void Main(string[] args)
        {
            int[] firstArray = { 1, 4, 3, 4, 4, 1, 1, 1, 1, 2 };
            int firstSeekedNumber = 1;
            Console.WriteLine(IsBiggerThenNeighbours (firstArray, firstSeekedNumber));
        }
    }
}
